<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition template="Admin-template.xhtml">
	<ui:param name="title" value="SỬA THÔNG TIN SẢN PHẨM" />
	<ui:define name="body">
		<h:form>
			<h:graphicImage url="#{editProductBean.image}" />
			<h:panelGrid columns="2">
				<h:outputText value="Nhóm(*)"/>
				<h:selectOneListbox value="#{editProductBean.cateCode}" size="1" onchange="$('.btnLoadSubcat').click()">
					<c:forEach items="#{mstBean.allCategories}" var="aCat">
						<f:selectItem itemLabel="#{aCat.name}" itemValue="#{aCat.code}" />
					</c:forEach>
				</h:selectOneListbox>
				
				<h:outputText value="Nhóm con(*)"/>
				<h:selectOneListbox value="#{editProductBean.subcatCode}" size="1">
					<c:forEach items="#{editProductBean.subCats}" var="aSubCat">
						<f:selectItem itemLabel="#{aSubCat.name}" itemValue="#{aSubCat.code}" />
					</c:forEach>
				</h:selectOneListbox>
				
				<h:outputText value="Mã(*)" />
				<h:inputText value="#{editProductBean.name}" />
				
				<h:outputText value="Mô tả" />
				<h:inputText value="#{editProductBean.detail}" />
				
				<h:outputText value="Giá" />
				<h:inputText value="#{editProductBean.price}" />
				
				<h:outputText value="Giá khuyến mãi" />
				<h:inputText value="#{editProductBean.salePrice}" />
				
				<h:outputText value="Số lượng" />
				<h:inputText value="#{editProductBean.quantity}" />
				
				<h:outputText value="Hình ảnh" />
				<h:inputText value="#{editProductBean.image}" />
			</h:panelGrid>
			
			<h:panelGrid columns="2">
				<h:selectBooleanCheckbox value="#{editProductBean.special}"/>
				<h:outputText value="Đặc biệt" />
				<h:selectBooleanCheckbox value="#{editProductBean.sale}" onchange="onSaleCheckboxChange(this)"/>
				<h:outputText value="Khuyến mãi" />
			</h:panelGrid>
			<br></br>				
			<h:commandButton action="#{editProductBean.update}" value="Sửa" />
			<h:commandButton styleClass="btnLoadSubcat" style="display:none" action="#{editProductBean.loadSubCats}"/>
		</h:form>
	</ui:define>
</ui:composition>
</html>